package exercisesI;

import java.util.Scanner;

public class Exercise6 {

	/**
	 * @author - Rafael Medina
	 * Calculate a function
	 */
	public static void main(String[] args) {
		
		// Declare the scanner variable
		Scanner sc = new Scanner(System.in);
		
		// Declare the y and x variables
		double x, y;
		
		// Ask the user for a value for x
		System.out.print("Please enter a value for x: ");
		x = sc.nextDouble();
		
		// Check whether x is > 0 or not
		
		if (x > 0){
			y = Math.pow(x, 2) + 2*x;
			System.out.print("f(x) = " + y);
		} else {
			y = x + 3;
			System.out.print("f(x) = " + y);
		}

	}

}
